public class Test {
    public static void main(String[] args) {
        String str1 =  String.valueOf(1234);
    }

    public static void main4(String[] args) {
        String str = "abcdefcde";
        String str1 = "ababcabcd";
        System.out.println(new Student("asdj",18));
        for (int i = 0; i < str.length(); i++) {
            //str[i] err str是string这个对象的引用，不是数组，不能使用[]
            char ch = str.charAt(i);//取得字符串i下标的值
            System.out.println(str.indexOf('c'));//从头开始找，遇到第一个就结束
            System.out.println(str.indexOf('c', 3));//从指定位置开始找，遇到就结束
            System.out.println(str.indexOf("abc"));//找到返回a的下标
            System.out.println(str.indexOf("abc", 5));
            System.out.println("===============================");
            System.out.println(str.lastIndexOf('c'));
            System.out.println(str.lastIndexOf('c', 3));
            System.out.println(str1.lastIndexOf("abc"));
            System.out.println(str1.lastIndexOf("abc", 6));
            System.out.println(str1.indexOf("abc", 3));
            System.out.println(str1.indexOf("abc", 4));

        }
    }

    public static void main3(String[] args) {
        String s1 = new String("hello");
        String s2 = new String("Hello");
        System.out.println(s1.compareToIgnoreCase(s2));//s1和s2比较 忽略大小写
        System.out.println(s1.equalsIgnoreCase(s2));//判断s1和s2是否相等 忽略大小写
    }
    public static void main2(String[] args) {
    //字符串比较
        String str = "hello bit";
        String str1 = new String("abc");
        char[] arr = {'a','b','c','d'};//字符数组
        String str2 = new String(arr);
        String str3 = "hello bit";
        String str4 = str3;
        System.out.println(str3 == str2);//比较的是就是str2和str3里面的值（由哈希封装的地址）
        System.out.println(str3 == str4);
        System.out.println(str3.equals(str2));
        int a = 20;
        double b = 20.0;
        System.out.println(a == b);//比较值
        System.out.println("==========================");
        int ret = str1.compareTo(str2);
        if(ret > 0){
            System.out.println("str1 > str2");
        }else if(ret == 0){
            System.out.println("str1 == str2");
        }else{
            System.out.println("str1 < str2");
        }


    }




    public static void main1(String[] args) {
        //字符串的初始化
        String str = "hello bit";
        System.out.println(str);
        String str1 = new String("abc");
        System.out.println(str1);
        char[] arr = {'a','b','c','d'};//字符数组
        String str2 = new String(arr);
        System.out.println(str2);
        System.out.println(str2.isEmpty());//字符串为空时返回true 否则返回false
        String str3 = str1;
        System.out.println(str3);
        String s1 = "hello";
        System.out.println("hello".length());
    }

}
